<?php	
	header('Content-type: application/json');
	require_once( '../wp-load.php' );	    
	global $wpdb;
	$posts = $wpdb->get_results("SELECT guid, media_type FROM wp_posts WHERE post_type = 'attachment' AND media_active = '1'");
	if ($posts != null) 
		echo json_encode($posts);
	else
		echo json_encode(array(), JSON_FORCE_OBJECT);		   							
	//backslash	
?>